package reflect;

import java.util.Scanner;

public class RefiectDemo2 {
    public static void main(String[] args) throws IllegalAccessException, InstantiationException, ClassNotFoundException {
        Class cls=Person.class;
        Object o=cls.newInstance();
        System.out.println(o);


        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入一个类的完全限定名");
        String ckassname=scanner.nextLine();

        Class clss=Class.forName(ckassname);
        Object obj=cls.newInstance();
        System.out.println(obj);
    }
}
